package com.remove.lsh.utils;

public final  class LSHUtil {

    /**
     *   转换成为32
     */
    public static byte[] toBytes(int lo) {
        byte[] targets = new byte[32];
        for (int i = 0; i < 32; i++) {
            int offset = 32-i-1;
            targets[i] = (byte) ((lo >>> offset) & 0x1);
        }
        return targets;
    }

    /**
     *  打印字节
     * @param bytes
     */
    public  static  void printType(byte [] bytes){
        StringBuilder sb  = new StringBuilder();
        for(int i=0,len =bytes.length;i<len ;i++){
            sb.append(bytes[i]);
            if(i!=0 && i%4 ==0 ){
                sb.append(" ");
            }
        }
        System.out.println("  print ----->  "+ sb.toString());
    }
    public  static  void printType(int [] ints){
        StringBuilder sb  = new StringBuilder();
        for(int i=0,len =ints.length;i<len ;i++){
            sb.append(ints[i]);
        }
        System.out.println("  print ----->  "+ sb.toString());
    }

}
